@extends('admin.layout.layout')
 @section('title')
 <title>阴阳师后台用户列表</title>
 @endsection
 @section('con')
 <div class="row"> 
     <div class="col-lg-12"> 
      <h1 class="page-header">用户列表
      </h1> 
     </div> 
     <!-- /.col-lg-12 --> 
    </div> 
    <!-- /.row --> 
    <html>
 <head></head>
 <body>
  <div class="col-lg-12"> 
   <div class="panel panel-default"> 
    <div class="panel-heading">
     用户列表 
    </div> 
    <!-- /.panel-heading --> 
    <div class="panel-body"> 
     <div class="dataTable_wrapper"> 
      <div id="dataTables-example_wrapper" class="dataTables_wrapper form-inline dt-bootstrap no-footer">
       <form action="{{url('./admin/user/index')}}" method="get">
        
        <div class="col-sm-6">
         <div id="dataTables-example_filter" class="dataTables_filter">
          <label>搜索:<input class="form-control input-sm" placeholder="" aria-controls="dataTables-example" type="search" name="keywords" value="{{$data['keywords'] or ''}}"/></label>
          <button class="btn">查询</button>
         </div>
        </div>
       </div>
       </form>
       <div class="row">
        <div class="col-sm-12">
         <table class="table table-striped table-bordered table-hover dataTable no-footer" id="dataTables-example" role="grid" aria-describedby="dataTables-example_info"> 
          <thead> 
           <tr role="row">
            <th class="sorting_asc" tabindex="0" aria-controls="dataTables-example" rowspan="1" colspan="1" style="width: 154.333px;" aria-sort="ascending" aria-label="Rendering engine: activate to sort column descending">ID</th>
            <th class="sorting" tabindex="0" aria-controls="dataTables-example" rowspan="1" colspan="1" style="width: 182.333px;" aria-label="Browser: activate to sort column ascending">头像</th>
            <th class="sorting" tabindex="0" aria-controls="dataTables-example" rowspan="1" colspan="1" style="width: 166.333px;" aria-label="Platform(s): activate to sort column ascending">用户名(s)</th>
            <th class="sorting" tabindex="0" aria-controls="dataTables-example" rowspan="1" colspan="1" style="width: 134.333px;" aria-label="Engine version: activate to sort column ascending">手机号</th>
            <th class="sorting" tabindex="0" aria-controls="dataTables-example" rowspan="1" colspan="1" style="width: 100px;" aria-label="CSS grade: activate to sort column ascending">邮箱</th>
            <th class="sorting" tabindex="0" aria-controls="dataTables-example" rowspan="1" colspan="1" style="width: 100px;" aria-label="CSS grade: activate to sort column ascending">权限</th>
             <th class="sorting" tabindex="0" aria-controls="dataTables-example" rowspan="1" colspan="1" style="width: 134.333px;" aria-label="Engine version: activate to sort column ascending">状态</th>
           </tr> 
          </thead> 
          <tbody> 
         @foreach($users as $k=>$v)
           <tr class="gradeA odd" role="row"> 
            <td class="sorting_1">{{$v->id}}</td> 
            <td><img src="{{$v->pic}}" width="100px" height="100px"></td>
            <td>{{$v->username}}</td> 
            <td class="center">{{$v->phone}}</td> 
            <td class="center">{{$v->email}}</td> 
            <td class="center">{{$v->auth}}</td> 
            <td class="center"><button type="button" class="btn btn-danger btn-xs btn-delete">删除</button><a href="{{url('/admin/user/edit',['id'=>$v->id])}}" class="btn btn-info btn-xs">修改</a></td>
          
           </tr>
           @endforeach
            
          
          </tbody> 
         </table>
        </div>
       </div>
       <div class="row">
        
        <div class="col-sm-12">
         <div class="dataTables_paginate paging_simple_numbers" id="dataTables-example_paginate">
        {!!$users->appends($data)->render()!!}
         </div>
        </div>
       </div>
      </div> 
     </div> 
     <!-- /.table-responsive --> 
     
    <!-- /.panel-body --> 
   </div> 
   <!-- /.panel --> 
  </div>
 </body>
</html>
 @endsection

 @section('js')

 <script type="text/javascript">

 $.ajaxSetup({
        headers: {
            'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
        }
})

       $('.btn-delete').click(function(){


    var id = $(this).parents('tr').find('.sorting_1').text();
    var btn =$(this);
    $.post('/admin/user/del',{id:id},function(data){
        if(data ==1){
            btn.parents('tr').remove();
        }else{
        
        }
   
 location.href= location.href;
    });
    
       })

 </script>
@endsection